package com.ioday01test;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class FileOutputStreamTest {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("0110.dat");
        int data = 1;
        fos.write(data);
        System.out.println("单字节写入完成");
        fos.close();

        FileOutputStream fos1 = new FileOutputStream("s.txt");
        String line = "写文本数据";
        byte[] data1 = line.getBytes(StandardCharsets.UTF_8);
        fos1.write(data1);
        System.out.println("字符串写入成功");


    }
}
